import axios from '@/utils/request';

/**
 * 获取供应商档案查询分页列表
 */
export async function QuerySupplierPageList(params) {
    const res = await axios.post('/Supplier/QuerySupplierPageList',params);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 新增供应商档案
 */
 export async function AddSupplier(params) {
    const res = await axios.post('/Supplier/AddSupplier',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 更新供应商档案
 */
 export async function UpdateSupplier(params) {
    const res = await axios.post('/Supplier/UpdateSupplier',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 删除供应商Id
 */
 export async function DeleteSupplier(id) {
    const res = await axios.post('/Supplier/DeleteSupplier?id='+id);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 根据id获取供应商档案
 */
 export async function GetSupplierById(id) {
    const res = await axios.get('/Supplier/GetModelById/'+id);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 获取所有供应商
 */
export async function GetAllBSupplier() {
    const res = await axios.get('/Supplier/GetAllBSupplier/');
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 根据类型获取第三方公司
 */
export async function QuerySupplierByType(type) {
    const res = await axios.post('/Supplier/QuerySupplierByType?type='+type);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}


 /**
  * 修改商品分类状态信息
  */
 export async function UpdateStatus(params) {
    const res = await axios.post('/Supplier/UpdateStatus',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
  }